import React, { useState } from 'react';
import monent from 'moment'

// 存在性能问题
function UnLazyMoment() {
  const [nowTime, setNowTime] = useState(Date.now())
  const changeTime = () => {
    setNowTime(monent(Date.now()).format())
  }

  return (
    <>
      <h2>显示时间为：{nowTime}</h2>
      <button onClick={changeTime}>改变时间格式</button>
    </>
  )
}

export default UnLazyMoment
